const {readJson,writeJson} = require('../../until/fs');
const {USER_JSON,STORE_ORDER} = require('../../config/config.data');
const moment = require('moment')
let getWorkData = (req,res) =>{

    let userData = readJson(USER_JSON)
    let orderData = readJson(STORE_ORDER);

    let workdata = {
        userData:{
            allPerson:userData.length,
            todayPerson:userData.filter(item=>item.loginTime>moment().startOf('day').valueOf()).length,
            allRealPerson:userData.filter(item=>item.name!==""&&item.card!=="").length,
          },
          orderData:{
            allOder:orderData.length,
            todayOrder:orderData.filter(item=>item.createTime>moment().startOf('day').valueOf()).length,
          }
    }
    res.send({code:1,msg:"测试数据出现",data:workdata})

}



module.exports = {
    getWorkData
}